/**
 * Copyright 2015 Qiyi Inc. All rights reserved.
 *
 * @file:   Channel.Config.js
 * @path:   js-src/StatisticOcr/
 * @desc:   StatisticOcr公共配置集合，键值对象
 *          一级键名大写，之间名采用驼峰式
 * @author: karkarrotxu@qiyi.com
 * @date:   2016-06-26
 */

qui(function (require, exports, module) {
        StatisticOcr2.Config = $.extend({}, Ancestor.Config, {

            TABLE_COLMODEL_CONFIG: {
                id: {
                    name: 'id',
                    index: 'id',
                    title: false,
                    width: 80,
                    align: 'center',
                    hidden: true,
                    sortable: false
                },
                user: {
                    name: 'user',
                    index: 'user',
                    width: 100,
                    align: 'center',
                    sortable: false,
                    title: false
                },
                channelName: {
                    name: 'channelName',
                    index: 'channelName',
                    width: 100,
                    align: 'center',
                    title: false,
                    sortable: false
                },
                userTitle: {
                    name: 'userTitle',
                    index: 'userTitle',
                    title: false,
                    width: 200,
                    sortable: false,
                    align: 'center'
                },
                ocrTitle: {
                    name: 'ocrTitle',
                    index: 'ocrTitle',
                    title: false,
                    width: 200,
                    sortable: false,
                    align: 'center'
                },
                userTitleCharLen: {
                    name: 'userTitleCharLen',
                    index: 'userTitleCharLen',
                    title: false,
                    width: 60,
                    sortable: false,
                    align: 'center',
                    formatter: function (v, o, r) {
                        return StatisticOcr2.Util.formatter.titleCharLen(v, o, r);
                    }
                },
                ocrTitleCharLen: {
                    name: 'ocrTitleCharLen',
                    index: 'ocrTitleCharLen',
                    title: false,
                    width: 60,
                    sortable: false,
                    align: 'center',
                    formatter: function (v, o, r) {
                        return StatisticOcr2.Util.formatter.titleCharLen(v, o, r);
                    }
                },
                ocrFlag: {
                    name: 'ocrFlag',
                    index: 'ocrFlag',
                    title: false,
                    width: 60,
                    sortable: false,
                    align: 'center',
                    formatter: function (v, o, r) {
                        return  StatisticOcr2.Util.formatter.ocrFlag(v, o, r);
                    }
                },
                percent: {
                    name: 'percent',
                    index: 'percent',
                    title: false,
                    width: 60,
                    sortable: false,
                    align: 'center',
                    formatter: function (v, o, r) {
                        return  StatisticOcr2.Util.formatter.percent(v, o, r);
                    }
                },
                addTime: {
                    name: 'addTime',
                    index: 'addTime',
                    title: false,
                    sortable: false,
                    width: 80,
                    align: 'center',
                    formatter: function (v, o, r) {
                        return  StatisticOcr2.Util.formatter.addTime(v, o, r);
                    }
                },
                legoProgramId: {
                    name: 'legoProgramId',
                    index: 'legoProgramId',
                    title: false,
                    sortable: false,
                    width: 100,
                    align: 'center'
                },
                liveBeginTime: {
                    name: 'liveBeginTime',
                    index: 'liveBeginTime',
                    title: false,
                    sortable: false,
                    width: 130,
                    align: 'center'
                },
                liveEndTime: {
                    name: 'liveEndTime',
                    index: 'liveEndTime',
                    title: false,
                    sortable: false,
                    width: 130,
                    align: 'center'
                },
                operator_download: {
                    title: false,
                    sortable: false,
                    width: 70,
                    align: 'center',
                    formatter: function (v, o, r) {
                        return  StatisticOcr2.Util.formatter.operator_download(v, o, r);
                    }
                }
            },


            TABLE_OCR_NEW: {
                url: StatisticOcr2.urlConfig.newListUrl,
                multiselect: true,
                loadtext: '加载中...',
                loadui: 'block',
                rowNum: 20,
                loadBeforeSend: function (xhr, settings) {
                    var auth = Ancestor.Util.getAuth("/statistic/data/ocr/new");
                    xhr.setRequestHeader('Sign', auth.sign);
                    xhr.setRequestHeader("Time", auth.clientTime);
                    xhr.setRequestHeader("From", auth.from);
                    return true;
                },
                datatype: "json",
                height: 450,
                caption: "OCR统计列表",
                prmNames: {
                    page: "pageNo",
                    rows: "pageSize"
                },
                colNames: ["创建日期", "乐高节目ID","编辑输入标题", "OCR提示标题", "电视台", "制作人员", "是否使用\n智能拆条", "输入标题\n字数", "提示标题\n字数", "准确率", "直播开始时间", "直播结束时间", "样本下载"],
                colModel: ['addTime',"legoProgramId", 'userTitle', 'ocrTitle', 'channelName', 'user',
                    'ocrFlag', 'userTitleCharLen', 'ocrTitleCharLen', 'percent', 'liveBeginTime', 'liveEndTime', 'operator_download'],
                pager: "#pager",
                loadComplete: function () {
                    console.log(" loadComplete notify ");
                    $("#query_avg_loading").show();
                    $("#query_avg_over").hide();
                    if($("#list").data("data") != null && $("#list").data("data").code == "A00000"){
                        $("span[name=span_total_num]").html($("#list").data("data").data.totalCount);
                        StatisticOcr2.Util.doQueryAvgPercent();
                     //   $("#list").data("data")
                    }else{
                        $("#query_avg_loading").hide();
                    }
                },
                gridComplete: function () {
                    console.log(" gridComplete notify ");
                }
            }
        });
    }
);